package com.example.qxfw.qxxx.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.qxfw.common.entity.qx.Water;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
@DS("qx")
public interface WaterMapper extends BaseMapper<Water> {
    @Select("SELECT stationname, smallscalewaterstatus, latestobservetime " +
            "FROM water " +
            "WHERE stationname LIKE #{stationName} " +
            "AND latestobservetime = (" +
            "   SELECT MAX (latestobservetime) " +
            "   FROM water " +
            "   WHERE stationname LIKE #{stationName})")
    List<Water> groupWaters(@Param("stationName") String stationName);

}
